var contentPanel=new Ext.TabPanel({
               	   id:"tabPanel",
                   region:'center',
                   deferredRender:false,
                   activeTab:0,
                   iconCls: 'tabs',
                   items:[{
                       contentEl:'center',
                       title: '主页',
                       autoScroll:true
                   }]
                });
                
Ext.onReady(function(){
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    var loader;
    var root;
    var basePath = "http://localhost:8081/ssha";
    loader = new Ext.tree.TreeLoader({
                    url : basePath + '/login!jsonData.action'
                });
   loader.on('beforeload', function(treeloader, node) {
         treeloader.baseParams = {
            id : node.id,
             method : 'tree'
         };
    }, this);
     
    root = new Ext.tree.AsyncTreeNode({
                    id : '0',
                    text : "VonEarth's ExtTree"
                });
                
    var north = new Ext.BoxComponent({
		region:'north',
		el: 'north',
		height:26
	}); 
	
    // tree start
    var tree = new Ext.tree.TreePanel({
        title: '基础业务功能',
        region: 'west',
        split: true,
        border: true,
        collapsible: true,
        width: 150,
        minSize: 80,
        maxSize: 200,
        loader : loader,
        root : root,
        rootVisible:false, //false不显示根节点,默认为true
        //enableDD : true,
       
    });

    root.expand(Ext.getBody());
    // tree end

    // layout start
    var viewport = new Ext.Viewport({
        layout:'border',
        items:[{
            region: 'north',
            contentEl: 'north-div',
            height: 40,
            bodyStyle: 'background-color:#BBCCEE;'
        },tree,contentPanel]
    });
    // layout end
});

//定义菜单导航函数   
function onClickMenuItem(node){			
	var n = contentPanel.getComponent(node.id);
	if (!n) { //判断是否已经打开该面板		
		n = contentPanel.add({	
		'id':node.id,
		'title':node.text,
		closable:true,
		autoLoad:{url:'tabFrame.jsp?url=' + node.href, callback: this.initSearch, scope: this, scripts:true} //通过autoLoad属性载入目标页,如果要用到脚本,必须加上scripts属性
		}); 	
	}	
	contentPanel.setActiveTab(n); 		
} 